<?php
// +----------------------------------------------------------------------
// | 幕小铺
// +----------------------------------------------------------------------
// | 版权所有 2016~2020 幕小铺科技（大连）有限公司
// +----------------------------------------------------------------------
// | 2020/03/14
// +----------------------------------------------------------------------
namespace app\erp\behavior\order_pay;

/**
 * 订单支付成功 店员通知
 * @package app\user_center\behavior\user
 * @author shiqiang
 */
class notice{
    /**
     * 执行行为 run方法是Behavior唯一的接口
     * @access public
     * @return void
     */
    public function run($params){
		$order_id   = $params['order_id'];
		
        $orderobj = model('ErpGoodsOrder') -> find($order_id);//查询订单数据
        $store_id = $orderobj -> store_id;
        
        $map = [];
        $map['store_id'] = $store_id;
        $list = model('user/User', 'model') -> where($map) -> select();
        foreach ($list as $key => $value) {

            if(!isset($value-> get_uc_member_mobile)) continue;
            $send_uid = $value-> get_uc_member_mobile -> uid;
            //推送通知
            $title = "订单提醒";
            $content = '门店有一个新得订单！id:'.$order_id;
            $rel = controller('common/PushFactory', 'designpattern\push') -> setPush($type='');
            $result = $rel->setPushByAlias($alias=$send_uid, $title, $content);
        }
		
    }
}
